<pre>
How to use (example)

Export the table schema to Excel. First row = table headers
save file as fname.csv
<?php
require_once ("include.php");

if ($fname = @$_REQUEST['fname']) {
 if (($handle = fopen("$fname.csv", "r")) !== false) {
  sqlexec("delete from dump.$fname");
  if (($conn = getconn()) !== false) {
   $data = fgetcsv($handle, 9000, ",");
   $num = count($data);
   $type = str_repeat("s", $num);
   $stmt = "INSERT INTO dump.$fname (";
   for ($c = 0; $c < $num; $c++) {
    if ($c !== 0) {
     $stmt .= ",";
    }
    $stmt .= $data[$c];
   }
   $stmt .= ") values (";
   for ($c = 0; $c < $num; $c++) {
    if ($c !== 0) {
     $stmt .= ",";
    }
    $stmt .= "?";
   }
   $stmt .= ")";
   xd($stmt);

   $sqlst = mysqli_prepare($conn, $stmt);

   while (($data = fgetcsv($handle, 9000, ",")) !== false) {

    for ($i = 0; $i < $num; $i++) {
     if (!isset($data[$i])) {
      $data[$i] = "";
     }
    }

    call_user_func_array('mysqli_stmt_bind_param', array_merge(array($sqlst, $type), $data));

    $sqlst->execute();
    xd($sqlst->error);
   }
   fclose($handle);
   mysqli_close($conn);
  } else {
   xd("Could not get a connection");
  }
 } else {
  xd("Could not open file $fname.csv");
 }
} else {
 echo("fname must be in the request string");
}

?>